﻿/// <reference path="../Libs/jquery-1.4.4.js" />
/// <reference path="../Libs/jquery-1.4.4-vsdoc.js" />

var global = {
    // --- 设置cookie
    setCookie: function (sName,sValue,expireHours) {
	    var cookieString = sName + "=" + escape(sValue);
	    //;判断是否设置过期时间
	    if (expireHours>0) {
		     var date = new Date();
		     date.setTime(date.getTime + expireHours * 3600 * 1000);
		     cookieString = cookieString + "; expire=" + date.toGMTString();
        }
        document.cookie = cookieString + "; path=/";
    },
    //--- 获取cookie
    getCookie: function (sName) {
      var aCookie = document.cookie.split("; ");
      for (var j=0; j < aCookie.length; j++){
	    var aCrumb = aCookie[j].split("=");
	    if (escape(sName) == aCrumb[0])
	      return unescape(aCrumb[1]);
      }
      return null;
    }
};
